PROJECT(stm32-chibios)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
ENABLE_LANGUAGE(ASM)

FIND_PACKAGE(ChibiOS COMPONENTS nil hal pal serial REQUIRED)

INCLUDE_DIRECTORIES(
    ${CMAKE_CURRENT_SOURCE_DIR}    
    ${ChibiOS_INCLUDE_DIRS}
)

SET(PROJECT_SOURCES
    main.c
    board.c
)

ADD_DEFINITIONS(-DCORTEX_USE_FPU=FALSE)

SET(STM32_LINKER_SCRIPT ${ChibiOS_LINKER_SCRIPT})

ADD_EXECUTABLE(${CMAKE_PROJECT_NAME} ${PROJECT_SOURCES} ${ChibiOS_SOURCES})
TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME})

STM32_SET_TARGET_PROPERTIES(${CMAKE_PROJECT_NAME})
STM32_ADD_HEX_BIN_TARGETS(${CMAKE_PROJECT_NAME})
